<html>
    <head>
        <link rel="stylesheet" href="/css/publication/publication.css" />
        <link rel="stylesheet" href="/css/home/home.css" />
        <script type="text/javascript" src="/js/publication/publicationrefresh.js"></script>
    </head>
    <body>
        <table id="" cellpadding="0" cellspacing="0" class="mainLayout">
            <tr>
                <td align="left" class="paddingRight10 mainLeftCol" >
                    <table cellpadding="0" cellspacing="0" width="100%" class="paddingLeft10" style="font-size: 12px;color: #333333;">
                        <tr>
                            <td colspan="2">&nbsp;</td>
                        </tr>
                        <tr class="paddingBottom10">
                            <td colspan="2" >
                                <span class="publicationTitle"><?php echo $research->getTitle(); ?></span>
                            </td>
                        </tr>
                             <tr >
                            <td height="10px">

                            </td>
                        </tr>
                        <?php if($research->getCitation() != NULL): ?>
                        <tr>
                            <td colspan="2" >
                                <span class="citationText"><?php echo Structures_BibTex::bibToCite(htmlspecialchars_decode($research->getCitation())); ?></span>
                            </td>
                        </tr>
                        <?php endif; ?>
                        <tr >
                            <td height="10px">

                            </td>
                        </tr>
                          <tr>
                            <td colspan="2" class="tdPublicationDetailToolbar">
                                <table cellpadding="0" cellspacing="0">
                                    <tr>
                                         <?php if( $sf_user->isAuthenticated() && $sf_user->getAttribute('currentuser')->getEntitytyperefid() == Types::$ENT_TYPE[Types::$ENT_TYPE_PROFESSOR] && $selectedTab == Types::$RESEARCH_TABS[Types::$RESEARCH_TABS_PENDING_APPROVAL] ): ?>
                                        <td class="approve">
                                        <a class="clickable" onclick="setApprovalStatus(<?php echo $research->getId(); ?>, <?php echo Types::$RESEARCH_APPROVAL_STATUS[Types::$APPR_APPROVED]; ?>, 'hfSelectionStatus', <?php echo $sf_user->getAttribute('currentuser')->getId(); ?>);"><div>Approve</div></a>
                                        </td>
                                        <td class="reject">
                                        <a class="clickable" onclick="setApprovalStatus(<?php echo $research->getId(); ?>, <?php echo Types::$RESEARCH_APPROVAL_STATUS[Types::$APPR_REVISION]; ?>, 'hfSelectionStatus', <?php echo $sf_user->getAttribute('currentuser')->getId(); ?>);"><div>Reject</div></a>
                                        </td>
                                        <?php endif; ?>
                                        <td class="download">
                                            <a id="<?php echo $research['id'] ?>" class="btnPublicationdownload"><div  align="left">Download Data</div></a>
                                        </td>
                                        <td class="visualization">
                                            <a onclick="loadResearchVisualization(<?php echo $research->getId(); ?>,'<?php echo $research->getTitle(); ?>')"><div  align="left">visualization</div></a>
                                        </td>

                                        <?php if($sf_user->isAuthenticated()): ?>
                                            <?php if($research->getEntityid() == $sf_user->getAttribute('currentuser')->getId() || Researchgroup::isUserCollaboratingForThisResearch($sf_user->getAttribute('currentuser')->getId(), $research->getId())): ?>
                                            <td class="editPaper" ">
                                                <a id="lnkEditPaper" href="<?php echo url_for('data/editResearch?id='.$research->getId()) ?>"><div  align="left">Edit Paper</div></a>
                                            </td>
                                            <?php endif; ?>

                                            <?php if($research->getEntityid() == $sf_user->getAttribute('currentuser')->getId()): ?>
                                            <td class="addUser" align="right" >
                                                <a id="lnkAddUser" onclick="return loadNewCollaborativeUserDialog(20,400,false,'dlgAddUser_ViewPublication', <?php echo $research->getId(); ?>, 'txtRid');"><div  align="left">Add User</div></a>
                                            </td>
                                            <?php endif; ?>
                                        <?php endif; ?>

                                        <?php if($research["researchpaperurl"]!=""): ?>
                                        <td class="link">
                                            <a href="<?php echo $research["researchpaperurl"] ?>" target="_blank"><div  align="left">View Paper</div></a>
                                        </td>
                                        <?php endif; ?>
                                    <tr>
                                </table>

                            </td>
                         </tr>



                        <tr>
                            <td colspan="2" class="dottedLine">
                                <span class="dottedLine">&nbsp;</span>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <p>
                                    <span>Dated: <?php echo $research->getPublicationdate(); ?></span>
                                </p>
                            </td>
<!--                            <td align="right">
                                <a href="#" style="text-decoration: none"><div>visualization</div></a>
                             </td>-->
                        </tr>
                        <tr>
                            <td colspan="2">&nbsp;</td>
                        </tr>

                        <?php if($research->getAbstract() != NULL): ?>
                        <tr class="paddingBottom10">
                            <td colspan="2" align="left">
                                <span class="abstractHeading">Abstract</span>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2" class="publicationText">
                                <span><?php echo $research->getAbstract(); ?></span>
                            </td>
                        </tr>
                        <?php endif; ?>
                        <?php if($research->getRemarks() != NULL): ?>
                        <tr>
                            <td colspan="2">&nbsp;</td>
                        </tr>
                        <tr class="paddingBottom10">
                            <td colspan="2" align="left">
                                <span class="abstractHeading">Remarks</span>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2" class="publicationText">
                                <span><?php echo $research->getRemarks(); ?></span>
                            </td>
                        </tr>
                        <?php endif; ?>

                        <tr>
                            <td colspan="2">&nbsp;</td>
                        </tr>
                        <tr>
                            <td>
                                <span class="abstractHeading">Contributor</span>
                                <ul>
                                    <li><a href="<?php echo url_for('home/userProfile?id='.RBISUtility::encryptURLParamValue($research->Entity->getId())); ?>"><?php echo $research->Entity->getFullname(); ?></a></li>
                                </ul>
                            </td>
                        </tr>

                        <?php $collaboratorList = $research->getCollaboratorList(array( Types::$COLLABORATION_REQUEST_STATUS[Types::$COLLABORATION_REQUEST_STATUS_APPROVED] ), false); ?>
                        
                        <tr>
                            <td colspan="2">&nbsp;</td>
                        </tr>
                        <tr>
                            <td id="tdCollaboratorList_<?php echo $research->getId(); ?>">
                                <span class="abstractHeading">Collaborator(s)</span>

                                <ul>
                                    <?php foreach ($research->getCollaboratorList(array( Types::$COLLABORATION_REQUEST_STATUS[Types::$COLLABORATION_REQUEST_STATUS_REJECTED] ), TRUE) as $collaborator): ?>
                                        <li>
                                            <?php if ($sf_user->isAuthenticated()): ?>
                                                <?php if(($research->getEntityid() == $sf_user->getAttribute('currentuser')->getId())): ?>
                                                    <a href="<?php echo url_for('home/userProfile?id='.RBISUtility::encryptURLParamValue($collaborator->getCollaborativeentityid())); ?>"><?php echo Entity::GetEntity( $collaborator->getCollaborativeentityid())->getFullname(); ?></a>
                                                    <?php if($collaborator->getCollaborationrequesttyperefid() == Types::$COLLABORATION_REQUEST_STATUS[Types::$COLLABORATION_REQUEST_STATUS_APPROVED]): ?>
                                                        <a class="clickable" onclick="return removeCollaborativeUser(<?php echo $collaborator->getCollaborativeentityid(); ?>, <?php echo $research->getId(); ?>);">(Remove)</a>

                                                    <?php elseif($collaborator->getCollaborationrequesttyperefid() == Types::$COLLABORATION_REQUEST_STATUS[Types::$COLLABORATION_REQUEST_STATUS_PENDING]): ?>
                                                        (Pending/<a class="clickable" onclick="return removeCollaborativeUser(<?php echo $collaborator->getCollaborativeentityid(); ?>, <?php echo $research->getId(); ?>);">Remove</a>)

                                                    <?php endif; ?>
                                                <?php elseif ($collaborator->getCollaborativeentityid() == $sf_user->getAttribute('currentuser')->getId()): ?>
                                                        <?php if($collaborator->getCollaborationrequesttyperefid() == Types::$COLLABORATION_REQUEST_STATUS[Types::$COLLABORATION_REQUEST_STATUS_APPROVED]): ?>
                                                            <?php echo Entity::GetEntity( $collaborator->getCollaborativeentityid())->getFullname(); ?>
                                                            <a class="clickable" onclick="return removeCollaborativeUser(<?php echo $collaborator->getCollaborativeentityid(); ?>, <?php echo $research->getId(); ?>);">(Remove)</a>

                                                        <?php else: ?>

                                                        <?php endif; ?>
                                                <?php endif; ?>
                                            <?php else: ?>
                                                <?php echo Entity::GetEntity( $collaborator->getCollaborativeentityid())->getFullname(); ?>
                                            <?php endif; ?>
                                        </li>
                                    <?php endforeach; ?>
                                </ul>
                            </td>
                        </tr>
                        
                      
                    </table>

                    <input id="txtRid" type="hidden"/>
                    <div id="boxes">
                        <div id="dlgAddUser_ViewPublication" class="window ui-dialog ui-widget ui-widget-content ui-corner-all">
                            <div class="ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix">
                                <span class="ui-dialog-title" id="ui-dialog-title-observation-form-dialog">Invite collaborator</span>
                                <a onclick="javascript:$('.window').hide()" class="ui-dialog-titlebar-close ui-corner-all clickable" role="button">
                                    <span class="ui-icon ui-icon-closethick">close</span>
                                </a>
                            </div>
                            <table cellpadding="0" cellspacing="0" width="100%" style="padding: 10px; font-size: 90%">
                                <tr>
                                    <td colspan="2">&nbsp;</td>
                                </tr>
                                <tr id="trErrorMessage">
                                    <td colspan="2">&nbsp;</td>
                                </tr>
                                <tr>
                                    <td align="left" nowrap>
                                        <span>User Name</span>
                                    </td>
                                    <td align="right">
                                        <input style="width: 290px; padding: 3px;" type="text" id="txtMailTo" onclick="javascript:LoadUserList();" class="ui-autocomplete-input required text ui-widget-content ui-corner-all"/>
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="2">&nbsp;</td>
                                </tr>
                                <tr>
                                    <td align="center">

                                    </td>
                                    <td align="right">
                                        <button class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" id="lnkAddUser" onclick="return addCollaborativeUser(document.getElementById('txtRid').value, $('#txtMailTo').val(), false);">
                                            <span class="ui-button-text">Add User</span>
                                        </button>
                                        <button class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" onclick="javascript:$('.window').hide();">
                                            <span class="ui-button-text">Cancel</span>
                                        </button>
                                    </td>
                                </tr>
                            </table>
                        </div>
                    </div>
                </td>
                <td align="left" class="mainRightCol">
<!--                    <table cellpadding="0" cellspacing="0" width="100%">
                        <tr>
                            <td class="paddingLeft10 paddingTop10 underline">
                                <table cellpadding="0" cellspacing="0" class="paddingLeft10">
                                    <tr>
                                        <td colspan="2">
                                            <a href="#"><h2> <?php //echo $research->Entity->getFullname(); ?> </h2></a>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td rowspan="2">
                                            <img width="100" height="100" src="<?php //echo url_for('entityImage/index?entityid='.$research->getEntityid()) ?>" alt="<?php //echo $research->Entity->getFullname();  ?>"/>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="2">&nbsp;</td>
                                    </tr>
                                    <tr>
                                        <td colspan="2">&nbsp;</td>
                                    </tr>
                                    <?php
                                        //$institute = $research->Entity->getUniversity();
                                        //$position = $research->Entity->getPosition();
                                    ?>
                                    <?php //if( !empty ( $institute ) && !empty ( $position ) ): ?>
                                    <tr>
                                        <td colspan="2">
                                            <span class="paddingLeft10"><?php //echo $position.' @ '.$institute; ?></span>
                                        </td>
                                    </tr>
                                    <?php //endif; ?>
                                    <tr>
                                        <td colspan="2">
                                            <span class="paddingLeft10">Contact: <?php //echo $research->Entity->getContact(); ?></span>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="2">
                                            <span class="paddingLeft10">Email: <?php //echo $research->Entity->getEmail(); ?></span>
                                        </td>
                                    </tr>
                                </table>
                            </td>
                            <td>&nbsp;</td>
                        </tr>
                    </table>-->
                </td>
            </tr>
        </table>
        
    </body>
</html>